<?xml version="1.0" encoding="UTF-8"?>
<?altova_samplexml Claims.xml?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
	<xsl:output method="xhtml" indent="yes" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
	<xsl:include href="DelphiDoc.Namespace.xslt"/>
	<xsl:include href="DelphiDoc.Namespace.Class.xslt"/>
	<xsl:include href="DelphiDoc.Namespace.Class.Members.xslt"/>
	<xsl:include href="DelphiDoc.Shared.xslt"/>
	<xsl:template match="/">
		<!--   Namespace -->
		<xsl:for-each select="namespace">
			<xsl:variable name="namespaceName" select="@name"/>
			<xsl:call-template name="OutputTemplate">
				<xsl:with-param name="title" select="$namespaceName"/>
				<xsl:with-param name="rootTemplate" select="."/>
			</xsl:call-template>
			<!-- Classes -->
			<xsl:for-each select="class">
				<xsl:variable name="className" select="@name"/>
				<xsl:call-template name="OutputTemplate">
					<xsl:with-param name="title"><xsl:value-of select="$namespaceName"/><xsl:text>.</xsl:text><xsl:value-of select="$className"/></xsl:with-param>
					<xsl:with-param name="rootTemplate" select="."/>
				</xsl:call-template>
				<!-- Member (methods) Summary -->
				<xsl:call-template name="OutputTemplate">
					<xsl:with-param name="title"><xsl:value-of select="$namespaceName"/><xsl:text>.</xsl:text><xsl:value-of select="$className"/><xsl:text> Members</xsl:text></xsl:with-param>
					<xsl:with-param name="rootTemplate" select="members"/>
				</xsl:call-template>
				<!-- Members (methods) - Function, Constructor,  Procedure -->
				<xsl:for-each select="members/function | members/procedure | members/constructor">
					<xsl:variable name="memberName" select="@name"/>
					<xsl:call-template name="OutputTemplate">
						<xsl:with-param name="title"><xsl:value-of select="$namespaceName"/><xsl:text>.</xsl:text><xsl:value-of select="$className"/><xsl:text>.</xsl:text><xsl:value-of select="$memberName"/></xsl:with-param>
						<xsl:with-param name="rootTemplate" select="."/>
					</xsl:call-template>
				</xsl:for-each>
			</xsl:for-each>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="OutputTemplate">
		<xsl:param name="title"/>
		<xsl:param name="rootTemplate"/>
		<xsl:result-document href="{$title}.html">
			<html>
				<head>
					<title>
						<xsl:value-of select="$title"/>
					</title>
					<link href="DelphiDoc.css" type="text/css" rel="stylesheet"/>
				</head>
				<body>
					<xsl:apply-templates select="$rootTemplate"/>
				</body>
			</html>
		</xsl:result-document>
	</xsl:template>
</xsl:stylesheet>
